# -*- coding: utf-8 -*-
# @Time: 2021/9/7 22:25
# @Author: yh
# @Remark: 执行任务
import logging
import os
import sys
import asyncio

base_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
sys.path.insert(0, base_dir)
sys.path.insert(0, os.path.dirname(base_dir))

from server.common.VideoManage.VideoQuality.task import TaskServer
from utils.conf.mxlog import setup_log

setup_log(logging.INFO)


class Task(object):

    @staticmethod
    def start(task_code):
        """
        开始执行巡检任务
        :param task_code: 任务code
        """
        asyncio.run(TaskServer(task_code).start())


if __name__ == '__main__':
    if len(sys.argv) == 2:
        task = Task()
        task.start(sys.argv[1])
